package cn.wolfcode.crm.domain;

import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

@Getter
@Setter
public class Salary {
    private Long id;

    private BigDecimal money;

    private Integer year;

    private Integer month;

    //private Long employeeId;
    private Employee employee;

    //private Long payoutId;
    private SystemDictionaryItem systemDictionaryItem;

    public String getJsonData() throws Exception {
        Map<String, Object> map = new HashMap<>();
        map.put("id",id);
        map.put("money",this.money);
        map.put("year",this.year);
        map.put("month",this.month);
        map.put("employeeId",this.employee.getId());
        map.put("payoutId",this.systemDictionaryItem.getId());
        return new ObjectMapper().writeValueAsString(map);
    }


}